/*
 * Created on Sep 17, 2008 
 *  
 * COPYRIGHT (C) 2008, ZyXEL Corporation (WuXi) Co., Ltd                  
 * Protected as an unpublished work. All Rights Reserved.
 * ZYXEL PROPRIETARY/CONFIDENTIAL.                                               
 * 
 * The computer program listings, specifications, and 
 * documentation herein are the property of ZYXEL 
 * Corporation and shall not be reproduced, copied, 
 * disclosed, or used in whole or in part for any reason 
 * without the prior express written permission of     
 * ZYXEL Corporation.                                    
 */
package cnm.validator.xpath;

import java.io.InputStream;


/**
 * 
 * @author Harry
 * @version
 *
 */
public class XPathValidatorFactory {

    private XPathValidatorFactory() {}
    
    private static XPathValidatorFactory instance;
    
    public static XPathValidatorFactory getInstance() {
        if (instance == null) {
            instance = new XPathValidatorFactory();
        }
        return instance;
    }
    
    public XPathValidator createXPathValidator(String className,InputStream in) {
        XPathValidator xpath = null;
        try {
            xpath = (XPathValidator)Class.forName(className).newInstance();
            xpath.setIn(in);
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        return xpath;
    }
    
}
